<template>
  <div class="toast" v-show="isShow">
      {{mass}}
  </div>
</template>

<script>
  export default {
    name: "Toast",
    data(){
      return {
        mass:'',
        isShow: false
      }
    },
    methods:{
      show(text,time = 2000){
        this.mass = text
        this.isShow = true
        setTimeout(() => {
          this.isShow = false
          this.mass = ''
        }, time)
      }
    }
  }
</script>

<style scoped>
  .toast {
    position: fixed;
    top: 50%;
    left: 50%;
    background: rgba(0,0,0,.7);
    color: white;
    transform: translate(-50%,-50%);
    padding: 10px 12px;
    z-index: 999;
  }
</style>
